package com.itzzj.common.response;

import com.itzzj.common.enums.ResultCode;

/**
 * 响应结果返回封装
 */
public class ResultResponse {

    // 只返回状态
    public static Result success(){
        return new Result().setResult(ResultCode.SUCCESS);
    }

    // 返回数据
    public static Result success(Object data){
        return new Result().setResult(ResultCode.SUCCESS,data);
    }

    // 系统出现异常
    public static Result failure(){
        return new Result().setResult(ResultCode.INTERNAL_SERVER_ERROR);
    }

    // 自定义返回错误的状态
    public static Result failure(ResultCode resultCode){
        return new Result().setResult(resultCode);
    }

    // 自定义返回状态和数据
    public static Result failure(ResultCode resultCode,Object data){
        return new Result().setResult(resultCode,data);
    }
}
